package main

import (
	"com.cracker/src/com.cracker/app/service"
	log "github.com/sirupsen/logrus"
	"os"
)

func main() {
	flagService := service.FlagService{}
	flagModel := flagService.Parse()
	Initialize()
	client := &service.Client{
		Heartbeat: flagModel.Heartbeat,
		Address:   flagModel.Address,
		Password:  flagModel.Password,
		Port:      flagModel.Port,
		HttpPort:  flagModel.HttpPort,
		Uid:       flagModel.Uid,
		Token:     flagModel.Token,
	}
	client.Connect()
	select {}
}

func Initialize() {
	// 设置日志格式为json格式
	log.SetFormatter(&log.JSONFormatter{})

	// 设置将日志输出到标准输出（默认的输出为stderr，标准错误）
	// 日志消息输出可以是任意的io.writer类型
	log.SetOutput(os.Stdout)

	// 设置日志级别为warn以上
	log.SetLevel(log.WarnLevel)
}
